const add = (a, b) => {
  let result = "";
  const _a = a.toString().split("").reverse();
  const _b = b.toString().split("").reverse();
  console.log(_a, _b);
  let extra = 0;

  // 找两者之间最大的
  const compare = _a.length > _b.length ? _a : _b;

  compare.forEach((element, index) => {
    const sum = ~~_a[index] + ~~_b[index];
    const _sum = extra + sum;

    extra = Math.floor(_sum / 10);
    result = (_sum % 10) + result;
  });

  if (extra) result = 1 + result;

  return result;
};

const sum = add(11111111111112222, 4444444444444444444);
console.log(sum);
